package com.gitee.wsl.common.zxing

import com.gitee.wsl.common.zxing.SCANNER.BARCODE_FORMATS
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
class ZXingScanConfig(
    val qrCodeFormat: Boolean,
    val takeSmallQrCodeFormat: Boolean = true,
    val qrCodeFilter: Boolean = false,
    val useFrontCam:Boolean = false,
    val enabledBarcodeFormats: Set<String> = BARCODE_FORMATS
) {
    /*companion object{
        const val FRONT_CAM = "front_cam"
        const val SCANNER_FORMAT_2D = "scanner_format_2d"
        const val BARCODE_FORMATS = "barcode_formats"
        const val EXTERNAL_SCANNER = "external_scanner"
    }*/
}

object BarcodeFormats {
    const val BARCODE_FORMAT_CODE128 = "barcode_format_code128"
    const val BARCODE_FORMAT_CODE39 = "barcode_format_code39"
    const val BARCODE_FORMAT_CODE93 = "barcode_format_code93"
    const val BARCODE_FORMAT_CODABAR = "barcode_format_codabar" // only ML Kit
    const val BARCODE_FORMAT_EAN13 = "barcode_format_ean13"
    const val BARCODE_FORMAT_EAN8 = "barcode_format_ean8"
    const val BARCODE_FORMAT_ITF = "barcode_format_itf"
    const val BARCODE_FORMAT_UPCA = "barcode_format_upca"
    const val BARCODE_FORMAT_UPCE = "barcode_format_upce"
    const val BARCODE_FORMAT_QR = "barcode_format_qr"
    const val BARCODE_FORMAT_PDF417 = "barcode_format_pdf417"
    const val BARCODE_FORMAT_AZTEC = "barcode_format_aztec" // only ML Kit
    const val BARCODE_FORMAT_MATRIX = "barcode_format_matrix"
    const val BARCODE_FORMAT_RSS14 = "barcode_format_rss14" // only ZXing
    const val BARCODE_FORMAT_RSSE = "barcode_format_rsse" // only ZXing
}

object SCANNER {
    const val FRONT_CAM = false
    const val SCANNER_FORMAT_2D = false
    val BARCODE_FORMATS: Set<String> = setOf<String>(
            BarcodeFormats.BARCODE_FORMAT_CODE128,
            BarcodeFormats.BARCODE_FORMAT_CODE39,
            BarcodeFormats.BARCODE_FORMAT_CODE93,
            BarcodeFormats.BARCODE_FORMAT_CODABAR,
            BarcodeFormats.BARCODE_FORMAT_EAN13,
            BarcodeFormats.BARCODE_FORMAT_EAN8,
            BarcodeFormats.BARCODE_FORMAT_ITF,
            BarcodeFormats.BARCODE_FORMAT_UPCA,
            BarcodeFormats.BARCODE_FORMAT_UPCE,
            BarcodeFormats.BARCODE_FORMAT_QR,
            BarcodeFormats.BARCODE_FORMAT_PDF417,
            BarcodeFormats.BARCODE_FORMAT_AZTEC,
            BarcodeFormats.BARCODE_FORMAT_MATRIX,
            BarcodeFormats.BARCODE_FORMAT_RSS14,
            BarcodeFormats.BARCODE_FORMAT_RSSE
    )
    const val EXTERNAL_SCANNER = false
}